<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Spaghetti code</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Spaghetti_code"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Spaghetti_code rootpage-Spaghetti_code skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Spaghetti code</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p><b>Spaghetti code</b> is a <a href="Pejorative" title="Pejorative">pejorative</a> phrase for difficult-to-<a href="Software_maintenance" title="Software maintenance">maintain</a> and unstructured <a href="Computer" title="Computer">computer</a> <a href="Source_code" title="Source code">source code</a>. Code being developed with poor structure can be due to any of several factors, such as volatile project requirements, lack of <a href="Programming_style" title="Programming style">programming style</a> rules, and <a href="Software_engineer" class="mw-redirect" title="Software engineer">software engineers</a> with insufficient ability or experience.<sup id="cite_ref-Markus4_1-0" class="reference"><a href="#cite_note-Markus4-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Meaning">Meaning</h2></div>
<p>Code that overuses <a href="Goto" title="Goto">GOTO</a> statements rather than <a href="Structured_programming" title="Structured programming">structured programming</a> constructs, resulting in convoluted and unmaintainable programs, is often called spaghetti code.<sup id="cite_ref-Cram5_2-0" class="reference"><a href="#cite_note-Cram5-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
Such code has a complex and tangled <a href="Control_structure" class="mw-redirect" title="Control structure">control structure</a>, resulting in a program flow that is conceptually like a <a href="Spaghetti#Serving" title="Spaghetti">bowl of spaghetti</a>, twisted and tangled.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p><p>In a 1980 publication by the <a href="National_Institute_of_Standards_and_Technology" title="National Institute of Standards and Technology">United States National Bureau of Standards</a>, the phrase <i><b>spaghetti program</b></i> was used to describe older programs having "fragmented and scattered files".<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p>Spaghetti code can also describe an <a href="Anti-pattern" title="Anti-pattern">anti-pattern</a> in which <a href="Object-oriented_programming" title="Object-oriented programming">object-oriented code</a> is written in a procedural style, such as by creating classes whose methods are overly long and messy, or forsaking object-oriented concepts like <a href="Polymorphism_(computer_science)" title="Polymorphism (computer science)">polymorphism</a>.<sup id="cite_ref-Moha10_5-0" class="reference"><a href="#cite_note-Moha10-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> The presence of this form of spaghetti code can significantly reduce the comprehensibility of a system.<sup id="cite_ref-Abbes11_6-0" class="reference"><a href="#cite_note-Abbes11-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="History">History</h2></div>
<p>It is not clear when the phrase spaghetti code came into common usage; however, a references appeared in 1972 including <i>The principal motivation behind eliminating the goto statement is the hope that the resulting programs will not look like a bowl of spaghetti.</i> by Martin Hopkins.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> In the 1978 book <i>A primer on disciplined programming using PL/I, PL/CS, and PL/CT</i>, <a href="Richard_W._Conway" title="Richard W. Conway">Richard Conway</a> described programs that "have the same clean logical structure as a plate of spaghetti",<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup> a phrase repeated in the 1979 book <i>An Introduction to Programming</i> he co-authored with <a href="David_Gries" title="David Gries">David Gries</a>.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> In the 1988 paper <i>A spiral model of software development and enhancement</i>, the term is used to describe the older practice of the <i>code and fix model</i>, which lacked planning and eventually led to the development of the <a href="Waterfall_model" title="Waterfall model">waterfall model</a>.<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> In the 1979 book <i>Structured programming for the COBOL programmer</i>, author Paul Noll uses the phrases <i>spaghetti code</i> and <i>rat's nest</i> as synonyms to describe poorly structured source code.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup>
</p><p>In the <i>Ada – Europe '93</i> conference, <a href="Ada_(programming_language)" title="Ada (programming language)">Ada</a> was described as forcing the programmer to "produce understandable, instead of spaghetti code", because of its restrictive exception propagation mechanism.<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup>
</p><p>In a 1981 computer languages spoof in <i>The Michigan Technic</i> titled "BASICally speaking...FORTRAN bytes!!", the author described <a href="FORTRAN" class="mw-redirect" title="FORTRAN">FORTRAN</a> stating that "it consists entirely of spaghetti code".<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup>
</p><p><a href="Richard_Hamming" title="Richard Hamming">Richard Hamming</a> described in his lectures<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup> the etymology of the term in the context of early programming in binary codes:
</p>
<style data-mw-deduplicate="TemplateStyles:r1244412712">
/* start https://en.wikipedia.org/ */
.mw-parser-output .templatequote{overflow:hidden;margin:1em 0;padding:0 32px}.mw-parser-output .templatequotecite{line-height:1.5em;text-align:left;margin-top:0}@media(min-width:500px){.mw-parser-output .templatequotecite{padding-left:1.6em}}
/* end https://en.wikipedia.org/ */
</style><blockquote class="templatequote"><p>If, in fixing up an error, you wanted to insert some omitted instructions then you took the immediately preceding instruction and replaced it by a transfer to some empty space. There you put in the instruction you just wrote over, added the instructions you wanted to insert, and then followed by a transfer back to the main program. Thus the program soon became a sequence of jumps of the control to strange places. When, as almost always happens, there were errors in the corrections you then used the same trick again, using some other available space. As a result <i>the control path of the program through storage soon took on the appearance of a can of spaghetti.</i> Why not simply insert them in the run of instructions? Because then you would have to go over the entire program and change all the addresses which referred to any of the moved instructions! Anything but that!</p></blockquote>
<div class="mw-heading mw-heading2"><h2 id="Related_phrases">Related phrases</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Ravioli_code">Ravioli code</h3></div>
<p><a href="Ravioli" title="Ravioli">Ravioli</a> code is a term specific to <a href="Object-oriented_programming" title="Object-oriented programming">object-oriented programming</a>. It describes code that comprises well-structured <a href="Class_(computer_programming)" title="Class (computer programming)">classes</a> that are easy to understand in isolation, but difficult to understand as a whole.<sup id="cite_ref-Troyer91_15-0" class="reference"><a href="#cite_note-Troyer91-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Lasagna_code">Lasagna code</h3></div>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">See also: <a href="Architectural_layer" class="mw-redirect" title="Architectural layer">Architectural layer</a> and <a href="Layer_(object-oriented_design)" title="Layer (object-oriented design)">Layer (object-oriented design)</a></div>
<p><a href="Lasagna" title="Lasagna">Lasagna</a> code refers to code whose layers are so complicated and intertwined that making a change in one layer would necessitate changes in all other layers.<sup id="cite_ref-Latchezar18_16-0" class="reference"><a href="#cite_note-Latchezar18-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Examples">Examples</h2></div>
<p>Here follows what would be considered a trivial example of spaghetti code in <a href="BASIC_programming_language" class="mw-redirect" title="BASIC programming language">BASIC</a>. The program prints each of the numbers 1 to 100 to the screen along with its square. Indentation is not used to differentiate the various actions performed by the code, and the program's <code><a href="Goto" title="Goto">GOTO</a></code> statements create a reliance on <a href="Line_number" title="Line number">line numbers</a>. The flow of execution from one area to another is harder to predict. Real-world occurrences of spaghetti code are more complex and can add greatly to a program's maintenance costs.
</p>
<div class="mw-highlight mw-highlight-lang-basic mw-content-ltr" dir="ltr"><pre><span class="nl">1</span><span class="w"> </span><span class="vg">i</span><span class="o">=</span><span class="il">0</span>
<span class="nl">2</span><span class="w"> </span><span class="vg">i</span><span class="o">=</span><span class="vg">i</span><span class="o">+</span><span class="il">1</span>
<span class="nl">3</span><span class="w"> </span><span class="kr">PRINT</span><span class="w"> </span><span class="vg">i</span><span class="p">;</span><span class="s2">"squared="</span><span class="p">;</span><span class="vg">i</span><span class="o">*</span><span class="vg">i</span>
<span class="nl">4</span><span class="w"> </span><span class="kr">IF</span><span class="w"> </span><span class="vg">i</span><span class="o">>=</span><span class="il">100</span><span class="w"> </span><span class="kr">THEN</span><span class="w"> </span><span class="kr">GOTO</span><span class="w"> </span><span class="nl">6</span>
<span class="nl">5</span><span class="w"> </span><span class="kr">GOTO</span><span class="w"> </span><span class="nl">2</span>
<span class="nl">6</span><span class="w"> </span><span class="kr">PRINT</span><span class="w"> </span><span class="s2">"Program Completed."</span>
<span class="nl">7</span><span class="w"> </span><span class="kr">END</span>
</pre></div>
<p>Here is the same code written in a <a href="Structured_programming" title="Structured programming">structured programming</a> style:
</p>
<div class="mw-highlight mw-highlight-lang-basic mw-content-ltr" dir="ltr"><pre><span class="nl">1</span><span class="w"> </span><span class="kr">FOR</span><span class="w"> </span><span class="vg">i</span><span class="o">=</span><span class="il">1</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="il">100</span>
<span class="nl">2</span><span class="w"> </span><span class="kr">PRINT</span><span class="w"> </span><span class="vg">i</span><span class="p">;</span><span class="s2">"squared="</span><span class="p">;</span><span class="vg">i</span><span class="o">*</span><span class="vg">i</span>
<span class="nl">3</span><span class="w"> </span><span class="kr">NEXT</span><span class="w"> </span><span class="vg">i</span>
<span class="nl">4</span><span class="w"> </span><span class="kr">PRINT</span><span class="w"> </span><span class="s2">"Program Completed."</span>
<span class="nl">5</span><span class="w"> </span><span class="kr">END</span>
</pre></div>
<p>The program jumps from one area to another, but this jumping is formal and more easily predictable, because <a href="For_loop" title="For loop">for loops</a> and <a href="Subroutine" class="mw-redirect" title="Subroutine">functions</a> provide <a href="Control_flow" title="Control flow">flow control</a> whereas the <i>goto</i> statement encourages arbitrary flow control. Though this example is small, real world programs are composed of many lines of code and are difficult to maintain when written in a spaghetti code fashion.
</p><p>Here is another example of spaghetti code with embedded GOTO statements.
</p>
<div class="mw-highlight mw-highlight-lang-basic mw-content-ltr" dir="ltr"><pre><span class="w"> </span><span class="kr">INPUT</span><span class="w"> </span><span class="s2">"How many numbers should be sorted? "</span><span class="p">;</span><span class="w"> </span><span class="vg">T</span>
<span class="w"> </span><span class="kd">DIM</span><span class="w"> </span><span class="vg">n</span><span class="p">(</span><span class="vg">T</span><span class="p">)</span>
<span class="w"> </span><span class="kr">FOR</span><span class="w"> </span><span class="vg">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="il">1</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="vg">T</span>
<span class="w"> </span><span class="kr">PRINT</span><span class="w"> </span><span class="s2">"NUMBER:"</span><span class="p">;</span><span class="w"> </span><span class="vg">i</span>
<span class="w"> </span><span class="kr">INPUT</span><span class="w"> </span><span class="vg">n</span><span class="p">(</span><span class="vg">i</span><span class="p">)</span>
<span class="w"> </span><span class="kr">NEXT</span><span class="w"> </span><span class="vg">i</span>
<span class="w"> </span><span class="c1">'Calculations:</span>
<span class="w"> </span><span class="vg">C</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="vg">T</span>
<span class="nl">E180:</span>
<span class="w"> </span><span class="vg">C</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kr">INT</span><span class="p">(</span><span class="vg">C</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="il">2</span><span class="p">)</span>
<span class="w"> </span><span class="kr">IF</span><span class="w"> </span><span class="vg">C</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="il">0</span><span class="w"> </span><span class="kr">THEN</span><span class="w"> </span><span class="kr">GOTO</span><span class="w"> </span><span class="nl">C330</span>
<span class="w"> </span><span class="vg">D</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="vg">T</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="vg">C</span>
<span class="w"> </span><span class="vg">E</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="il">1</span>
<span class="nl">I220:</span>
<span class="w"> </span><span class="vg">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="vg">E</span>
<span class="nl">F230:</span>
<span class="w"> </span><span class="vg">g</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="vg">f</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="vg">C</span>
<span class="w"> </span><span class="kr">IF</span><span class="w"> </span><span class="vg">n</span><span class="p">(</span><span class="vg">f</span><span class="p">)</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="vg">n</span><span class="p">(</span><span class="vg">g</span><span class="p">)</span><span class="w"> </span><span class="kr">THEN</span><span class="w"> </span><span class="kr">SWAP</span><span class="w"> </span><span class="vg">n</span><span class="p">(</span><span class="vg">f</span><span class="p">),</span><span class="w"> </span><span class="vg">n</span><span class="p">(</span><span class="vg">g</span><span class="p">)</span>
<span class="w"> </span><span class="vg">f</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="vg">f</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="vg">C</span>
<span class="w"> </span><span class="kr">IF</span><span class="w"> </span><span class="vg">f</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="il">0</span><span class="w"> </span><span class="kr">THEN</span><span class="w"> </span><span class="kr">GOTO</span><span class="w"> </span><span class="nl">F230</span>
<span class="w"> </span><span class="vg">E</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="vg">E</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="il">1</span>
<span class="w"> </span><span class="kr">IF</span><span class="w"> </span><span class="vg">E</span><span class="w"> </span><span class="o">></span><span class="w"> </span><span class="vg">D</span><span class="w"> </span><span class="kr">THEN</span><span class="w"> </span><span class="kr">GOTO</span><span class="w"> </span><span class="nl">E180</span>
<span class="w"> </span><span class="kr">GOTO</span><span class="w"> </span><span class="nl">I220</span>
<span class="nl">C330:</span>
<span class="w"> </span><span class="kr">PRINT</span><span class="w"> </span><span class="s2">"The sorted list is"</span>
<span class="w"> </span><span class="kr">FOR</span><span class="w"> </span><span class="vg">i</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="il">1</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="vg">T</span>
<span class="w"> </span><span class="kr">PRINT</span><span class="w"> </span><span class="vg">n</span><span class="p">(</span><span class="vg">i</span><span class="p">)</span>
<span class="w"> </span><span class="kr">NEXT</span><span class="w"> </span><span class="vg">i</span>
</pre></div>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1266661725">
/* start https://en.wikipedia.org/ */
.mw-parser-output .portalbox{padding:0;margin:0.5em 0;display:table;box-sizing:border-box;max-width:175px;list-style:none}.mw-parser-output .portalborder{border:1px solid var(--border-color-base,#a2a9b1);padding:0.1em;background:var(--background-color-neutral-subtle,#f8f9fa)}.mw-parser-output .portalbox-entry{display:table-row;font-size:85%;line-height:110%;height:1.9em;font-style:italic;font-weight:bold}.mw-parser-output .portalbox-image{display:table-cell;padding:0.2em;vertical-align:middle;text-align:center}.mw-parser-output .portalbox-link{display:table-cell;padding:0.2em 0.2em 0.2em 0.3em;vertical-align:middle}@media(min-width:720px){.mw-parser-output .portalleft{margin:0.5em 1em 0.5em 0}.mw-parser-output .portalright{clear:right;float:right;margin:0.5em 0 0.5em 1em}}
/* end https://en.wikipedia.org/ */
</style>
<ul><li><a href="Big_ball_of_mud" class="mw-redirect" title="Big ball of mud">Big ball of mud</a>, a piece of software with no perceivable architecture</li>
<li><a href="International_Obfuscated_C_Code_Contest" title="International Obfuscated C Code Contest">International Obfuscated C Code Contest</a>, a competition to produce pleasingly obscure C code</li>
<li><a href="Technical_debt" title="Technical debt">Technical debt</a></li>
<li><i><a href="The_Elements_of_Programming_Style" title="The Elements of Programming Style">The Elements of Programming Style</a></i></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap mw-references-columns"><ol class="references">
<li id="cite_note-Markus4-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-Markus4_1-0">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFMarkus2004" class="citation journal cs1">Markus, Pizka (2004). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20180305202716/http://itestra.com/wp-content/uploads/2017/08/04_itestra_straightening_spaghetti_code_with_refactoring.pdf">"Straightening spaghetti-code with refactoring?"</a> <span class="cs1-format">(PDF)</span>. <i>Software Engineering Research and Practice</i>: <span class="nowrap">846–</span>852. Archived from <a rel="nofollow" class="external text" href="http://itestra.com/wp-content/uploads/2017/08/04_itestra_straightening_spaghetti_code_with_refactoring.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 5 March 2018<span class="reference-accessdate">. Retrieved <span class="nowrap">5 March</span> 2018</span>.</cite></span>
</li>
<li id="cite_note-Cram5-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-Cram5_2-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFCramHedley2005" class="citation journal cs1">Cram, David; Hedley, Paul (2005). <a rel="nofollow" class="external text" href="https://web.archive.org/web/20180306022905/http://mostlyharmless.org.uk/wp-content/uploads/2010/12/cramhedley-web.pdf">"Pronouns and procedural meaning: The relevance of spaghetti code and paranoid delusion"</a> <span class="cs1-format">(PDF)</span>. <i>Oxford University Working Papers in Linguistics, Philology and Phonetics</i>. <b>10</b>: <span class="nowrap">187–</span>210. Archived from <a rel="nofollow" class="external text" href="http://mostlyharmless.org.uk/wp-content/uploads/2010/12/cramhedley-web.pdf">the original</a> <span class="cs1-format">(PDF)</span> on 6 March 2018<span class="reference-accessdate">. Retrieved <span class="nowrap">5 March</span> 2018</span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFHorstmann2008" class="citation book cs1">Horstmann, Cay (2008). <a rel="nofollow" class="external text" href="http://horstmann.com/bigjava3.html">"Chapter 6 - Iteration"</a>. <i>Java Concepts for AP Computer Science</i> (5th ed. [i.e. 2nd ed.]. ed.). Hoboken, NJ: J. Wiley & Sons. pp. <span class="nowrap">235–</span>236. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-470-18160-7</bdi><span class="reference-accessdate">. Retrieved <span class="nowrap">2 January</span> 2017</span>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite id="CITEREFUnited_States_National_Bureau_of_Standards1980" class="citation book cs1">United States National Bureau of Standards (1980). <i>ASTM special technical publication</i>. United States Government Printing Office.</cite></span>
</li>
<li id="cite_note-Moha10-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-Moha10_5-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFMohaGueheneucDuchienMeur2010" class="citation journal cs1">Moha, N.; Gueheneuc, Y. G.; Duchien, L.; Meur, A. F. Le (January 2010). "DECOR: A Method for the Specification and Detection of Code and Design Smells". <i>IEEE Transactions on Software Engineering</i>. <b>36</b> (1): <span class="nowrap">20–</span>36. <a href="CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.156.1524">10.1.1.156.1524</a></span>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2FTSE.2009.50">10.1109/TSE.2009.50</a>. <a href="ISSN_(identifier)" class="mw-redirect" title="ISSN (identifier)">ISSN</a> <a rel="nofollow" class="external text" href="https://search.worldcat.org/issn/0098-5589">0098-5589</a>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:14767901">14767901</a>.</cite></span>
</li>
<li id="cite_note-Abbes11-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-Abbes11_6-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFAbbesKhomhGueheneucAntoniol2011" class="citation book cs1">Abbes, M.; Khomh, F.; Gueheneuc, Y. G.; Antoniol, G. (2011). "An Empirical Study of the Impact of Two Antipatterns, Blob and Spaghetti Code, on Program Comprehension". <i>2011 15th European Conference on Software Maintenance and Reengineering</i>. pp. <span class="nowrap">181–</span>190. <a href="CiteSeerX_(identifier)" class="mw-redirect" title="CiteSeerX (identifier)">CiteSeerX</a> <span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.294.1685">10.1.1.294.1685</a></span>. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2FCSMR.2011.24">10.1109/CSMR.2011.24</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-1-61284-259-2</bdi>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:14152638">14152638</a>.</cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text">Hopkins, M. E. (1972): A Case fo the GOTO. In: ACM '72: Proceedings of the ACM annual conference - Volume 2, August 1972, pp 787–790, p 59 DOI:<a rel="nofollow" class="external free" href="https://dl.acm.org/doi/10.1145/800194.805860">https://dl.acm.org/doi/10.1145/800194.805860</a></span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><cite id="CITEREFConway1978" class="citation book cs1">Conway, Richard (1978). <i>A primer on disciplined programming using PL/I, PL/CS, and PL/CT</i>. Winthrop Publishers. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-87626-712-7</bdi>.</cite></span>
</li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><cite id="CITEREFConwayGries1979" class="citation book cs1">Conway, Richard; Gries, David (1979). <i>An Introduction to Programming</i> (3rd ed.). Little, Brown. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-0-316-15414-7</bdi>.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><cite id="CITEREFBoehm1988" class="citation journal cs1">Boehm, Barry W. (May 1988). "A spiral model of software development and enhancement". <i>IEEE Computer</i>. <b>21</b> (2): <span class="nowrap">61–</span>72. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1109%2F2.59">10.1109/2.59</a>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:1781829">1781829</a>.</cite></span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><cite id="CITEREFNoll1977" class="citation book cs1">Noll, Paul (1977). <i>Structured programming for the COBOL programmer: design, documentation, coding, testing</i>. M. Murach & Associates.</cite></span>
</li>
<li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text"><cite id="CITEREFSchwille1993" class="citation conference cs1">Schwille, Jürgen (1993). "Use and abuse of exceptions — 12 guidelines for proper exception handling". <i>Lecture Notes in Computer Science</i>. Ada – Europe '93 (Proceedings). Lecture Notes in Computer Science. Vol. 688. Springer Berlin Heidelberg. pp. <span class="nowrap">142–</span>152. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1007%2F3-540-56802-6_12">10.1007/3-540-56802-6_12</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-3-540-56802-5</bdi>.</cite></span>
</li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><cite id="CITEREFMTSBSCategory:Wikipedia_articles_needing_clarification_from_April_2015[clarification_needed]1981" class="citation journal cs1">MTSBS (March–April 1981). "BASICally speaking...FORTRAN bytes!!". <i>The Michigan Technic</i>. <b>99</b> (4).</cite><span class="cs1-maint citation-comment"><code class="cs1-code">{{cite journal}}</code>: CS1 maint: multiple names: authors list (link) CS1 maint: numeric names: authors list (link)</span></span>
</li>
<li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"><cite id="CITEREFHamming1996" class="citation book cs1">Hamming, Richard (1996). <i>The Art of Doing Science and Engineering</i>. Taylor & Francis. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>9056995006</bdi>.</cite></span>
</li>
<li id="cite_note-Troyer91-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-Troyer91_15-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFDe_Troyer1991" class="citation conference cs1">De Troyer, O. (13 May 1991). Andersen, Rudolf; Bubenko, Janis A.; Sølvberg, Arne (eds.). <a rel="nofollow" class="external text" href="https://pure.uvt.nl/ws/files/5292185/DTO5613576.pdf"><i>The OO-binary relationship model : A truly object oriented conceptual model</i></a> <span class="cs1-format">(PDF)</span>. Advanced Information Systems Engineering. Notes on Numerical Fluid Mechanics and Multidisciplinary Design. Vol. 498. pp. <span class="nowrap">561–</span>578. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1007%2F3-540-54059-8_104">10.1007/3-540-54059-8_104</a>. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <bdi>978-3-319-98176-5</bdi>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:10894568">10894568</a>.</cite></span>
</li>
<li id="cite_note-Latchezar18-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-Latchezar18_16-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFTomovIvanova2014" class="citation journal cs1">Tomov, Latchezar; Ivanova, Valentina (October 2014). <a rel="nofollow" class="external text" href="https://www.researchgate.net/publication/301298530">"Teaching Good Practices In Software Engineering by Counterexamples"</a>. <i>Computer Science and Education in Computer Science</i> (1): <span class="nowrap">397–</span>405<span class="reference-accessdate">. Retrieved <span class="nowrap">5 March</span> 2018</span>.</cite></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external text" href="http://portal.acm.org/citation.cfm?id=362929.362947">Go To Statement Considered Harmful</a>. The classic repudiation of spaghetti code by <a href="Edsger_Dijkstra" class="mw-redirect" title="Edsger Dijkstra">Edsger Dijkstra</a></li>
<li><a rel="nofollow" class="external text" href="http://www.fortran.com/fortran/come_from.html"><i>We don't know where to GOTO if we don't know where we've COME FROM</i> by R. Lawrence Clark from DATAMATION, December, 1973</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20180716171336/http://www.fortran.com/fortran/come_from.html">Archived</a> 2018-07-16 at the <a href="Wayback_Machine" title="Wayback Machine">Wayback Machine</a></li>
<li><a rel="nofollow" class="external text" href="http://yost.com/computers/java/java-spaghetti/">Refactoring Java spaghetti code into Java bento code</a> separating out a bowl full of code from one class into seven classes</li>
<li><a rel="nofollow" class="external text" href="https://archive.today/20130201082958/http://www.remotesynthesis.com/post.cfm/Objects-and-Frameworks--Taking-a-Step-Back">Objects and Frameworks – Taking a Step Back</a> by Brian Rinaldi</li>
<li><a rel="nofollow" class="external text" href="https://blog.docsity.com/en/study-tips/programming-2/programming-pasta-spaghetti-lasagna-ravioli-macaroni-code/">Programming Pasta - Spaghetti, Lasagna, Ravioli and Macaroni Code</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20230121050907/https://blog.docsity.com/en/study-tips/programming-2/programming-pasta-spaghetti-lasagna-ravioli-macaroni-code/">Archived</a> 2023-01-21 at the <a href="Wayback_Machine" title="Wayback Machine">Wayback Machine</a></li>
<li><a rel="nofollow" class="external text" href="https://www.techopedia.com/definition/24994/pasta-theory">Pasta Theory of Programming</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-05-19" href="https://en.wikipedia.org/wiki/?title=Spaghetti_code&oldid=1291220979">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>